fix: incorrect UTC conversion math#245
Merged
sigmachirality merged 7 commits intomainfrom Feb 6, 2026
Merged
Conversation
Changed .utc(true) to .utc() in selectTime function to properly convert local time to UTC instead of keeping the same time with UTC timezone. - 6pm PST now correctly shows as 2am UTC (not 10am UTC) - 7pm PST now correctly shows as 3am UTC (not 11am UTC) - Added comprehensive timezone conversion tests The bug was caused by using .utc(true) which keeps the same local time but marks it as UTC, instead of .utc() which actually converts the time. Co-authored-by: Daniel Tao <danieltaox@gmail.com>
|
Cursor Agent can help with this pull request. Just |
Co-authored-by: Daniel Tao <danieltaox@gmail.com>
Changed .utc(true) to .utc() and use isSame('day') to correctly check
if a date falls on the same calendar day in both local timezone and UTC.
Previously: dayjs(date).utc(true) kept the same time digits but marked as UTC
Now: dayjs(date).utc() properly converts the time, then we compare calendar days
Example: Feb 6 6pm PST = Feb 7 2am UTC (different days, returns false)
Example: Feb 6 10am PST = Feb 6 6pm UTC (same day, returns true)
Co-authored-by: Daniel Tao <danieltaox@gmail.com>
The previous implementation used formatDate(date.utc().toDate()) which still formatted in local timezone because JavaScript Date objects don't carry timezone info and formatDate uses toLocaleTimeString internally. Added formatDateAsUTC helper that formats directly using dayjs in UTC mode. Shows "Today" only when UTC and local fall on the same calendar day to avoid confusion. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This project uses bun, not npm. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
96dd715 to
88d7a38
Compare
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix timezone conversion in
sf nodes createcommand.The previous implementation used
.utc(true)which incorrectly marked local time as UTC instead of converting it, leading to incorrect UTC times being displayed (e.g., 6pm PST showing as 10am UTC instead of 2am UTC). This PR changes.utc(true)to.utc()insrc/helpers/units.tsto ensure proper conversion.